package com.lei2j.facade;

/**
 * Created by lei2j on 2019/1/27.
 */
public class MovieFacadeImpl implements MovieFacade {

    private Amplifier amplifier;

    private DvdPlayer dvdPlayer;

    private CdPlayer cdPlayer;

    private PopcornPopper popcornPopper;

    private Projector projector;

    private Screen screen;

    private TheaterLights theaterLights;

    private Tuner tuner;

    public MovieFacadeImpl(Amplifier amplifier, DvdPlayer dvdPlayer, CdPlayer cdPlayer, PopcornPopper popcornPopper, Projector projector, Screen screen, TheaterLights theaterLights, Tuner tuner) {
        this.amplifier = amplifier;
        this.dvdPlayer = dvdPlayer;
        this.cdPlayer = cdPlayer;
        this.popcornPopper = popcornPopper;
        this.projector = projector;
        this.screen = screen;
        this.theaterLights = theaterLights;
        this.tuner = tuner;
    }

    public void watchMoive(String movie) {
        System.out.println("watch movie");
        popcornPopper.on();
        popcornPopper.pop();
        theaterLights.dim(10);
        screen.down();
        projector.on();
        projector.wideScreenMode();
        amplifier.on();
        amplifier.setDvd("光年之外");
        amplifier.setSurroundSound();
        amplifier.setVolume(40);
        dvdPlayer.on();
        dvdPlayer.play();
    }

    public void endMoive() {
        System.out.println("end Movie");
        popcornPopper.off();
        theaterLights.off();
        screen.up();
        projector.off();
        amplifier.off();
        dvdPlayer.stop();
        dvdPlayer.eject();
        dvdPlayer.off();
    }
}
